Skip to content

TST: pandas/util/testing : test improvements and cleanups #4451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2013

Conversation

jtratner
Copy link
Contributor

@jtratner jtratner commented Aug 2, 2013

A few things

  1. Make with-statement-capable assertRaises and assertRaisesRegexp (which I want to use later in a cleanup of some of the parser tests).
  2. Earlier introduction of assert_attr_equal changed it so that, if one object had an attribute that was None and the other did not have that attribute at all, it would pass. This is now fixed.
  3. combines assert_panel_equal and assert_panel4d_equal, because they are both doing the same thing. Now it's just assert_panelnd_equal with specific assert functions for each.
  4. Switched unnecessary check_index_freq check in pandas.io.tests.test_pytables:TestHDFStore.test_index_types to be check_series_type, (because none of the tests ever produce objects with freqstr)
  5. Removed check_index_freq argument and corresponding code from assert_series_equal since it's not being actively used anywhere in the test suite

@jreback
Copy link
Contributor

jreback commented Aug 2, 2013

the freq checks are really to avoid having a separate method to check index vs index and datetime index vs datetime index, as the only the latter has a freq

@jtratner
Copy link
Contributor Author

jtratner commented Aug 2, 2013

@jreback Actually, none of the tests pass if you force the frequency check to be explicit. None of the objects produced have a freqstr attribute in that test.

@jreback
Copy link
Contributor

jreback commented Aug 2, 2013

right - even a datetime index does not necessarily have a freqstr

@jtratner
Copy link
Contributor Author

jtratner commented Aug 2, 2013

@jreback to be really clear, all I mean is that making it so that both objects have to have a freqstr is fine for the entirety of the test suite, it's just that one test that was doing it wrong (probably because check_freq was added and it didn't update its positional arguments).

@jtratner
Copy link
Contributor Author

jtratner commented Aug 2, 2013

@jreback at least in 2.7, it looks like that test is the only place in the entire test suite that checks index frequency.

@jreback
Copy link
Contributor

jreback commented Aug 2, 2013

it doesn't need to be explicitly test I think
because equals on 2 datetime indexes checks it

@jtratner
Copy link
Contributor Author

jtratner commented Aug 2, 2013

@jreback yeah, I'm just running this build right now - https://travis-ci.org/jtratner/pandas/builds/9791919 - which puts an assert False under the check_freq part of assert_series_equal and also checks that none of the functions in that one test case have freqstr. If it doesn't, are you okay with removing that argument and branch from assert_series_equal?

@jtratner
Copy link
Contributor Author

jtratner commented Aug 2, 2013

@jreback if you're okay with this, I'll squash it together - just wanted to leave them separate for now in case you didn't want a part of the PR.

@jreback
Copy link
Contributor

jreback commented Aug 2, 2013

this is all ok

that test was probably just thrown together (obviously should have kw args)

go ahead and I'll merge

@jtratner
Copy link
Contributor Author

jtratner commented Aug 2, 2013

@jreback does this need to go in docs? if so, since this is small, which file?

assertRaises and assertRaisesRegexp are now with-statement-compatible,
refactored assert_panel_equal and removed check_index_freq from
assert_series_equal.
@jreback
Copy link
Contributor

jreback commented Aug 2, 2013

@jtratner what do you mean go in docs?

@jtratner
Copy link
Contributor Author

jtratner commented Aug 2, 2013

meant to say release notes. I thought you all had said something about
wanted to move small fixes out of one doc (release.rst? v0.13.0.rst?)

@jreback
Copy link
Contributor

jreback commented Aug 2, 2013

oh....what I meant was that if you say fixing bug xyz, just put the reference in the release.rst. If its a feature (or important bug fix) or you just think most users should know about it in whatsnew then go ahead and put it in there TOO. But for the most part, no point in duplicating in BOTH release.rst and whatsnew (e.g. v0.13.0).

@jreback
Copy link
Contributor

jreback commented Aug 2, 2013

merge?

@jtratner
Copy link
Contributor Author

jtratner commented Aug 2, 2013

yes.

jreback added a commit that referenced this pull request Aug 2, 2013
TST: pandas/util/testing : test improvements and cleanups
@jreback jreback merged commit 58f1137 into pandas-dev:master Aug 2, 2013
@jreback
Copy link
Contributor

jreback commented Aug 2, 2013

thansk!

@jtratner jtratner deleted the better-assert-tests branch August 3, 2013 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants